package com.saihai.common.core.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.saihai.common.core.domain.entity.SysMenu;
import com.saihai.common.core.domain.entity.UfZzjgTree;

import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;

/**
 * ZzjgSelect
 *
 * @author ruoyi
 */
public class ZzjgSelect implements Serializable {
    private static final long serialVersionUID = 1L;

    /** 节点ID */
    private Long id;

    /** 节点名称 */
    private String label;

    /** 子节点 */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<ZzjgSelect> children;

    public ZzjgSelect()
    {

    }

    public List<ZzjgSelect> getChildren() {
        return children;
    }

    public void setChildren(List<ZzjgSelect> children) {
        this.children = children;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public ZzjgSelect(UfZzjgTree dept)
    {
        this.id = dept.getId();
        this.label = dept.getMc();
        this.children = dept.getChildren().stream().map(ZzjgSelect::new).collect(Collectors.toList());
    }

    public ZzjgSelect(SysMenu menu)
    {
        this.id = menu.getMenuId();
        this.label = menu.getMenuName();
        this.children = menu.getChildren().stream().map(ZzjgSelect::new).collect(Collectors.toList());
    }

}
